local luozhui = fk.CreateSkill {
  name = "th_luozhui",
}

luozhui:addEffect(fk.Damaged, {
  anim_type = "masochism",
  on_cost = function(self, event, target, player, data)
    return player.room:askToSkillInvoke(player, {
      skill_name = luozhui.name,
      prompt = "#th_luozhui-invoke"
    })
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    local cards = player:drawCards(2, luozhui.name)
    local tricks = table.filter(cards, function(cid) return Fk:getCardById(cid):isCommonTrick() end)
    room:askToUseRealCard(player, {
      pattern = tricks,
      skill_name = luozhui.name,
      prompt = "#th_luozhui-use"
    })
  end
})

Fk:loadTranslationTable{
  ["th_luozhui"] = "落锥",
  [":th_luozhui"] = "当你受到伤害后，你可以摸两张牌，若其中有普通锦囊牌，你可以使用之。",

  ["#th_luozhui-invoke"] = "落锥：你可以摸两张牌，若其中有普通锦囊牌，你可以使用之",
  ["#th_luozhui-use"] = "落锥：你可以使用其中的普通锦囊牌",
}

return luozhui